#pragma once

#include "QvObject.h"
#include "QvString.h"

#define CRYPTO_MD5          32771
#define CRYPTO_SHA          32772

/*
    QvCrypto md5;
    md5.Init();
    md5.Update((QvUByte*)"1242141342zdfzfdv", 10);
    md5.Update((QvUByte*)"zdfzfdv", 7);
    QvString str = md5.Final();
    wprintf(L"%s\n", str.GetUnicodeBuffer());
*/
class QvToolkit_Export QvCrypto : public QvObject
{
public:
    QvCrypto();
    virtual ~QvCrypto();

    QvBoolean Init(QvUInt32 nHashIdentify = CRYPTO_MD5);
    QvBoolean Update(QvUByte *input, QvInt32 nInputLen);
    QvString Final();

private:
    QvULong m_hHash;
};

/*
    QvCrypto md5;
    md5.Init(CRYPTO_MD5);
    md5.Update((QvUByte*)"", 0);
    QvString str = md5.Final();
    wprintf(L"%s\n", str.GetBuffer());

    md5.Init(CRYPTO_SHA);
    md5.Update((QvUByte*)"", 0);
    str = md5.Final();
    wprintf(L"%s\n", str.GetBuffer());
*/